##
##    This file is part of Metrix.
##
##    Metrix is free software: you can redistribute it and/or modify
##    it under the terms of the GNU General Public License as published by
##    the Free Software Foundation, either version 3 of the License, or
##    (at your option) any later version.
##
##    Metrix is distributed in the hope that it will be useful,
##    but WITHOUT ANY WARRANTY; without even the implied warranty of
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##    GNU General Public License for more details.
##
##    You should have received a copy of the GNU General Public License
##    along with Metrix.  If not, see <http://www.gnu.org/licenses/>.
##

class ProductosController < ApplicationController

  layout "productos"
  active_scaffold :producto do |config|
    config.label = "Productos"
    config.columns = [:nombre, :descripcion]
    config.list.columns = [:nombre, :descripcion]
    config.list.sorting = {:nombre => :asc}

	config.columns[:descripcion].label = "Descripción"

	##para ofrecer una buena navegabilidad sin moverse demasiado entre listas
	#columns[:nombre].set_link('nested', :parameters => {:associations => "versions"})
	
	##otra opcion es usar un boton adicional, pero es redundante si se usa lo de arriba
	#config.actions = [:list, :nested]
	#config.nested.add_link("Versiones", [:versions])

	##para ocultar el nested element (en este caso, las versiones)
	#config.actions.exclude :nested
	
	## Busqueda ajax
	config.actions.swap :search, :live_search

	## Castellano
	config.actions = [:show, :update, :delete, :create, :list, :live_search]
	config.show.link.label = 'Ver'
	config.update.link.label = 'Modificar'
	config.delete.link.label = 'Borrar'
	config.create.link.label = 'Crear'
	config.live_search.link.label = 'Buscar'
  end
end
